package com.itHsuSE.smallchange.oopTest;

public class Teacher extends Person{
    private int workAge;

    public Teacher(String name, char sex, int age, int workAge) {
        super(name, sex, age);
        this.workAge=workAge;
    }

    public int getWorkAge() {
        return workAge;
    }

    public void setWorkAge(int workAge) {
        this.workAge = workAge;
    }

    public void teach(){
        System.out.println("认真教学");
    }

    @Override
    public String play() {
        return super.play()+"象棋";
    }

    @Override
    public void printInfo() {
        System.out.println("老师的信息：");
        super.printInfo();
        System.out.println("工龄："+this.getWorkAge());
        this.teach();
        System.out.println(this.play());;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "workAge=" + workAge +
                '}'+super.toString();
    }
}
